﻿// -------------------------------------------------------------------------------------------------------------------------------
// <copyright file="TestMultiplyFactor.cs" company="Exul">
//     Copyright (c) Exul. All rights reserved.
// </copyright>
// <author>
//     Exul
// </author>
// -------------------------------------------------------------------------------------------------------------------------------

namespace ExulLibrary.Mathematics.LinearAlgebra.Sequential.Tests.DenseSymmetricMatrixTest.DoubleExtensions
{
    #region Usings

    using System;

    using ExulLibrary.Mathematics.LinearAlgebra.Sequential.DoubleExtensions;

    using NUnit.Framework;

    #endregion

    /// <summary>
    ///     Test suite for <see cref="DenseSymmetricMatrixExtensions.Multiply(DenseSymmetricMatrix{double}, double)"/>.
    /// </summary>
    [TestFixture]
    [Category("ExulLibrary.Mathematics.LinearAlgebra.Sequential.DoubleExtensions.DenseSymmetricMatrixExtensions")]
    public sealed class TestMultiplyFactor
    {
        /// <summary>
        ///     Tests the method.
        /// </summary>
        [Test]
        public void TestMethod()
        {
            // Arrange
            var data = new double[]
                       {
                           1,
                           2, 3
                       };
            var matrix = new DenseSymmetricMatrix<double>(data);
            var expectedResult = new double[]
                                 {
                                     10,
                                     20, 30
                                 };

            // Act
            matrix.Multiply(10);

            // Assert
            Assert.That(matrix.Values, Is.EquivalentTo(expectedResult));
        }

#if SAFE

        /// <summary>
        ///     Tests the method when matrix parameter is <see langword="null"/>.
        /// </summary>
        [Test]
        public void WhenMatrixIsNull()
        {
            // Act and Assert
            Assert.That(
                () => DenseSymmetricMatrixExtensions.Multiply(null, 10),
                Throws.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("matrix"));
        }

#endif
    }
}